<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">











<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Maven2 Java Formatter Plugin - java-formatter:format</title>
    <style type="text/css" media="all">
      @import url("./css/maven-base.css");
      @import url("./css/maven-theme.css");
      @import url("./css/site.css");
    </style>
    <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
      </head>
  <body class="composite">
    <div id="banner">
                    <span id="bannerLeft">
    
            Maven2 Java Formatter Plugin
    
            </span>
                    <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="breadcrumbs">
          
  

  
    
  
  
    
            <div class="xleft">
        Last Published: 2011-03-04
                      </div>
            <div class="xright">      
  

  
    
  
  
    
  </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="leftColumn">
      <div id="navcolumn">
           
  

  
    
  
  
    
                   <h5>Overview</h5>
            <ul>
              
    <li class="none">
                    <a href="http://code.google.com/p/maven-java-formatter-plugin/" class="externalLink">Project Home</a>
          </li>
              
    <li class="none">
                    <a href="index.html">Introduction</a>
          </li>
              
    <li class="none">
                    <a href="plugin-info.html">Goals</a>
          </li>
              
    <li class="none">
                    <a href="usage.html">Usage</a>
          </li>
          </ul>
              <h5>Examples</h5>
            <ul>
              
    <li class="none">
                    <a href="examples.html#Setting_Source_Files">Source Files</a>
          </li>
              
    <li class="none">
                    <a href="examples.html#Setting_Compiler_Version">Compiler Version</a>
          </li>
              
    <li class="none">
                    <a href="examples.html#System_Independent_Line_Endings">Line Endings</a>
          </li>
              
    <li class="none">
                    <a href="examples.html#Source File Encoding">File Encoding</a>
          </li>
              
    <li class="none">
                    <a href="examples.html#Custom_Configuration_File">Custom Formatting</a>
          </li>
              
    <li class="none">
                    <a href="examples.html#Multimodule_Configuration">Multimodule</a>
          </li>
          </ul>
              <h5>Project Documentation</h5>
            <ul>
              
                
              
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
              
        <li class="collapsed">
                    <a href="project-info.html">Project Information</a>
                </li>
              
                
              
      
              
        <li class="collapsed">
                    <a href="project-reports.html">Project Reports</a>
                </li>
          </ul>
                                           <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
            <img alt="Built by Maven" src="./images/logos/maven-feather.png"></img>
          </a>
                       
  

  
    
  
  
    
        </div>
    </div>
    <div id="bodyColumn">
      <div id="contentBox">
        <div class="section"><h2><a name="java-formatter:format"></a>java-formatter:format</h2>
<p><strong>Full name</strong>:</p>
<p>com.googlecode.maven-java-formatter-plugin:maven-java-formatter-plugin:0.3.1:format</p>
<p><strong>Description</strong>:</p>
<div>A Maven plugin mojo to format Java source code using the Eclipse
code formatter. Mojo parameters allow customizing formatting by
specifying the config XML file, line endings, compiler version, and
source code locations. Reformatting source files is avoided using
an md5 hash of the content, comparing to the original hash to the
hash after formatting and a cached hash.</div><p><strong>Attributes</strong>:</p>
<ul><li>Requires a Maven 2.0 project to be executed.</li>
<li>Binds by default to the lifecycle phase: <code>process-sources</code>.</li>
</ul>
<div class="section"><h3><a name="Optional_Parameters"></a>Optional Parameters</h3>
<table class="bodyTable"><tr class="a"><th>Name</th>
<th>Type</th>
<th>Since</th>
<th>Description</th>
</tr>
<tr class="b"><td><strong><a href="#compilerCompliance">compilerCompliance</a></strong></td>
<td><code>String</code></td>
<td><code>-</code></td>
<td>Java compiler compliance version.<br />
<strong>Default value is</strong>: <code>1.5</code>.</td>
</tr>
<tr class="a"><td><strong><a href="#compilerSource">compilerSource</a></strong></td>
<td><code>String</code></td>
<td><code>-</code></td>
<td>Java compiler source version.<br />
<strong>Default value is</strong>: <code>1.5</code>.</td>
</tr>
<tr class="b"><td><strong><a href="#compilerTargetPlatform">compilerTargetPlatform</a></strong></td>
<td><code>String</code></td>
<td><code>-</code></td>
<td>Java compiler target version.<br />
<strong>Default value is</strong>: <code>1.5</code>.</td>
</tr>
<tr class="a"><td><strong><a href="#configFile">configFile</a></strong></td>
<td><code>String</code></td>
<td><code>-</code></td>
<td>File or classpath location of an Eclipse code formatter
configuration xml file to use in formatting.<br />
</td>
</tr>
<tr class="b"><td><strong><a href="#directories">directories</a></strong></td>
<td><code>File[]</code></td>
<td><code>-</code></td>
<td><strong>Deprecated.</strong> Use includes/excludes instead<br />
</td>
</tr>
<tr class="a"><td><strong><a href="#encoding">encoding</a></strong></td>
<td><code>String</code></td>
<td><code>0.3</code></td>
<td>The file encoding used to read and write source files. When not
specified and sourceEncoding also not set, default is platform file
encoding.<br />
<strong>Default value is</strong>: <code>${project.build.sourceEncoding}</code>.</td>
</tr>
<tr class="b"><td><strong><a href="#excludes">excludes</a></strong></td>
<td><code>String[]</code></td>
<td><code>0.3</code></td>
<td>List of fileset patterns for Java source locations to exclude from
formatting. Patterns are relative to the project source and test
source directories. When not specified, there is no default
exclude.<br />
</td>
</tr>
<tr class="a"><td><strong><a href="#includes">includes</a></strong></td>
<td><code>String[]</code></td>
<td><code>0.3</code></td>
<td>List of fileset patterns for Java source locations to include in
formatting. Patterns are relative to the project source and test
source directories. When not specified, the default include is
<code>**/*.java</code><br />
</td>
</tr>
<tr class="b"><td><strong><a href="#lineEnding">lineEnding</a></strong></td>
<td><code>String</code></td>
<td><code>0.2.0</code></td>
<td>Sets the line-ending of files after formatting. Valid values are: 

<ul><li><b>&quot;AUTO&quot;</b> - Use line endings of current system</li>
<li><b>&quot;KEEP&quot;</b> - Preserve line endings of files, default to AUTO
if ambiguous</li>
<li><b>&quot;LF&quot;</b> - Use Unix and Mac style line endings</li>
<li><b>&quot;CRLF&quot;</b> - Use DOS and Windows style line endings</li>
<li><b>&quot;CR&quot;</b> - Use early Mac style line endings</li>
</ul>
<br />
<strong>Default value is</strong>: <code>AUTO</code>.</td>
</tr>
<tr class="a"><td><strong><a href="#overrideConfigCompilerVersion">overrideConfigCompilerVersion</a></strong></td>
<td><code>Boolean</code></td>
<td><code>0.2.0</code></td>
<td>Sets whether compilerSource, compilerCompliance, and
compilerTargetPlatform values are used instead of those defined in
the configFile.<br />
<strong>Default value is</strong>: <code>false</code>.</td>
</tr>
</table>
</div>
<div class="section"><h3><a name="Parameter_Details"></a>Parameter Details</h3>
<p><strong><a name="compilerCompliance">compilerCompliance</a>:</strong></p>
<div>Java compiler compliance version.</div><ul><li><strong>Type</strong>: <code>java.lang.String</code></li>
<li><strong>Required</strong>: <code>No</code></li>
<li><strong>Default</strong>: <code>1.5</code></li>
</ul>
<hr />
<p><strong><a name="compilerSource">compilerSource</a>:</strong></p>
<div>Java compiler source version.</div><ul><li><strong>Type</strong>: <code>java.lang.String</code></li>
<li><strong>Required</strong>: <code>No</code></li>
<li><strong>Default</strong>: <code>1.5</code></li>
</ul>
<hr />
<p><strong><a name="compilerTargetPlatform">compilerTargetPlatform</a>:</strong></p>
<div>Java compiler target version.</div><ul><li><strong>Type</strong>: <code>java.lang.String</code></li>
<li><strong>Required</strong>: <code>No</code></li>
<li><strong>Default</strong>: <code>1.5</code></li>
</ul>
<hr />
<p><strong><a name="configFile">configFile</a>:</strong></p>
<div>File or classpath location of an Eclipse code formatter
configuration xml file to use in formatting.</div><ul><li><strong>Type</strong>: <code>java.lang.String</code></li>
<li><strong>Required</strong>: <code>No</code></li>
</ul>
<hr />
<p><strong><a name="directories">directories</a>:</strong></p>
<div><strong>Deprecated.</strong> Use includes/excludes instead</div><div>Location of the Java source files to format.</div><ul><li><strong>Type</strong>: <code>java.io.File[]</code></li>
<li><strong>Required</strong>: <code>No</code></li>
</ul>
<hr />
<p><strong><a name="encoding">encoding</a>:</strong></p>
<div>The file encoding used to read and write source files. When not
specified and sourceEncoding also not set, default is platform file
encoding.</div><ul><li><strong>Type</strong>: <code>java.lang.String</code></li>
<li><strong>Since</strong>: <code>0.3</code></li>
<li><strong>Required</strong>: <code>No</code></li>
<li><strong>Default</strong>: <code>${project.build.sourceEncoding}</code></li>
</ul>
<hr />
<p><strong><a name="excludes">excludes</a>:</strong></p>
<div>List of fileset patterns for Java source locations to exclude from
formatting. Patterns are relative to the project source and test
source directories. When not specified, there is no default
exclude.</div><ul><li><strong>Type</strong>: <code>java.lang.String[]</code></li>
<li><strong>Since</strong>: <code>0.3</code></li>
<li><strong>Required</strong>: <code>No</code></li>
</ul>
<hr />
<p><strong><a name="includes">includes</a>:</strong></p>
<div>List of fileset patterns for Java source locations to include in
formatting. Patterns are relative to the project source and test
source directories. When not specified, the default include is
<code>**/*.java</code></div><ul><li><strong>Type</strong>: <code>java.lang.String[]</code></li>
<li><strong>Since</strong>: <code>0.3</code></li>
<li><strong>Required</strong>: <code>No</code></li>
</ul>
<hr />
<p><strong><a name="lineEnding">lineEnding</a>:</strong></p>
<div>Sets the line-ending of files after formatting. Valid values are: 

<ul><li><b>&quot;AUTO&quot;</b> - Use line endings of current system</li>
<li><b>&quot;KEEP&quot;</b> - Preserve line endings of files, default to AUTO
if ambiguous</li>
<li><b>&quot;LF&quot;</b> - Use Unix and Mac style line endings</li>
<li><b>&quot;CRLF&quot;</b> - Use DOS and Windows style line endings</li>
<li><b>&quot;CR&quot;</b> - Use early Mac style line endings</li>
</ul>
</div><ul><li><strong>Type</strong>: <code>java.lang.String</code></li>
<li><strong>Since</strong>: <code>0.2.0</code></li>
<li><strong>Required</strong>: <code>No</code></li>
<li><strong>Default</strong>: <code>AUTO</code></li>
</ul>
<hr />
<p><strong><a name="overrideConfigCompilerVersion">overrideConfigCompilerVersion</a>:</strong></p>
<div>Sets whether compilerSource, compilerCompliance, and
compilerTargetPlatform values are used instead of those defined in
the configFile.</div><ul><li><strong>Type</strong>: <code>java.lang.Boolean</code></li>
<li><strong>Since</strong>: <code>0.2.0</code></li>
<li><strong>Required</strong>: <code>No</code></li>
<li><strong>Default</strong>: <code>false</code></li>
</ul>
</div>
</div>

      </div>
    </div>
    <div class="clear">
      <hr/>
    </div>
    <div id="footer">
      <div class="xright">&#169;  
          2011
    
          
  

  
    
  
  
    
  </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
  </body>
</html>
